Repository navigation
feat(ui): stories v2 on the UI kit - #230
Merged
Merged
Conversation
Covers with the ring and its slide segments, previews and the bar, slide progress with the close button, the price plate with discount or a promo code that copies with a toast, the countdown timer, text blocks, the used-products row with its carousel sheet and sound button, and the product card of a slide. Tokens Neutral 100, Semantic/Info and Semantic/Neutral Subtle, speaker icons.
PersonalizationStories loads a stories block by code through the SDK, shows the bar and opens a fullscreen viewer built from the kit: product slides, media slides with dark tokens, text blocks at their offset, buttons, used products and video with a mute toggle. Slides are tracked like the legacy stories; the legacy StoriesView is left as it is.
A Stories V2 tab in the UI Kit showcase: the demo shop's live block, an offline sample block with every slide kind, and each building block on its own. The tab row scrolls now that there are five tabs.
Card/Story darkens the top and bottom of product slides on a plain background too, not only photos and video.
Price compares decimals and keeps fractional discounts, the ring lights seen slides by index, a story opens at its first unseen slide, only positive integer ids are tracked, slides default to 10 s, two-line cover labels, text blocks fall back to the preset line height of their size.
Navigation, start slide, pause reasons and the products sheet live in a view-free class covered by unit tests.
A 50 MB LRU cache shared by every viewer with next-slide preloading, audio focus taken only while the sound is on, and the block texts as string resources with a Russian translation.
The slide clock runs on Choreographer frames, so the animation scale no longer races through slides; the viewer pauses on background, focus loss, holds, drags and the open products sheet. Media is fitted with a letterbox, waits until ready (Retry after 10 s or a failure, videos retry themselves), videos run for their real length from the shared cache, sound is off by default, kept for the process and turned on by the volume key. Product slides keep their buttons, carousel and sound, text-block promo codes copy, controls respect system bars and cutouts. The widget takes V1's OnClickListener, forwards every text, gives up after 15 s with onError, opens by index or story id, pauses and resumes the viewer, and PersonalizationStories.show() opens a block without the bar.
PersonalizationStoriesWidget takes the view's parameters and a PersonalizationStoriesController for open, pause and resume. The viewer also styles the system bars and preloads when its page binds late.
The sample block shows a fitted photo with a letterbox, a broken image with Retry, a product video slide with buttons, carousel and sound, a text-block promo code and two-line labels; a Compose exhibit drives the wrapper with a controller and opens the block without the bar.
A GIF slide lasts the longer of its loop and the admin duration, stops on its frame whenever the slide is paused and starts from the first frame on a restart. Covers, product pictures and video posters show the first frame only.
…text block Text blocks stay off product slides, as in the mockup, but a promo code the admin put into one of them now shows in the card's promo block when the product has no code of its own.
…n old price The row took its height from the price column alone, so with a single price line the promo block cut its caption and code.
The picture took most of the tap zones, so a tap meant to page the story opened the shop instead. A tap on it now pages like anywhere on the slide; the buttons open the product.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stories V2 on the UI kit: a bar of covers and a full-screen viewer with media, video and GIF slides, product slides with the price and promo code, the products carousel and sound, plus a controller to open, pause and resume, and showing a block without the bar. It reads the same
stories/{code}block and sends the sametrack/storiesevents as the current stories.The current stories are untouched and stay what the SDK shows. V2 sits behind the UI kit's opt-in marker like the rest of the kit and is shown only in the demo app.